<?php require_once(dirname(__FILE__).'/inc/config.inc.php');IsModelPriv('weblink_list'); 
$starttimer = microtime(true);
$checkPagenum = isset($checkPagenum) ? $checkPagenum : $cfg_pagenum;
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>广告管理</title>
<link href="templates/css/style.css" rel="stylesheet" type="text/css" />
<link href="templates/css/pagination.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="templates/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/layindex.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/common.js"></script>
<script type="text/javascript" src="templates/js/loadimage.js"></script>
<script type="text/javascript" src="templates/js/forms.func.js"></script>
<script type="text/javascript">
$(function(){
    $(".thumbs img").LoadImage();
});

</script>
</head>
<body class="mainbody">
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i></i><span>返回上一页</span></a>
  <a href="home.php" class="home"><i></i><span>首页</span></a>
  <i class="arrow"></i>
  <span>友情链接管理</span>
  <a href="javascript:location.reload();" class="reload">刷新</a>
</div>
<!--/导航栏-->
<div id="floatHead" class="toolbar-wrap">
  <div class="toolbar">
    <div class="box-wrap">
      <a class="menu-btn"></a>
      <div class="l-list">
        <ul class="icon-list">
		<li><a class="add" href="weblink_add.php"><i></i><span>添加友情链接</span></a></li>
		  <li><a class="all" href="javascript:;" onclick="checkAll(this);"><i></i><span>全选</span></a></li>
		   <li><a href="javascript:DelAllNone('weblink_save.php');" onclick="return ConfDelAll(0);" class="del"><i></i><span>删除</span></a></li>
        </ul> 
		<div class="rule-single-select">
		<select name="tid" onchange="func('tid')" id="tid">
			<option selected="selected" value="all">查看全部</option>
			<?php
			$dosql->Execute("SELECT * FROM `#@__weblinktype` ORDER BY orderid ASC");
			while($row = $dosql->GetArray())
			{	if(@$tid==$row['id']) $select='selected="selected"';else $select=''; 
				echo '<option '.$select.' value="'.$row['id'].'">'.$row['classname'].'</option>';
			}
			?>
		</select>
         </div>
		 
      </div>
 
    </div>
  </div>
</div>

<form name="form" id="form" method="post" action="">
<div class="table-container">
	<table width="100%" border="0" cellpadding="0" cellspacing="0" class="ltable">
		<tr align="center" class="head">
			<th width="5%"><input type="checkbox" name="checkid" id="checkid" onclick="CheckAll(this.checked);"></td>
			<th width="5%">ID</th>
			<th width="15%">网站LOGO</th>
			<th width="20%">站点名称</th>
			<th width="25%">站点URL</th>
			<th width="10%">所属分类</th>
			<th width="20%" class="endCol">操作</th>
		</tr>
		<?php
		$sql = "SELECT * FROM `#@__weblink` WHERE `siteid`='$cfg_siteid'";

			if(isset($tid))
				if($tid=='all')
			{
				$sql .='';
			}
			else{$sql .= "AND `classid`=$tid";}
		$dopage->GetPage($sql,$checkPagenum,'DESC');
		while($row = $dosql->GetArray())
		{
			$row2 = $dosql->GetOne("SELECT `classname` FROM `#@__weblinktype` WHERE `id`=".$row['classid']);

			if(isset($row2['classname']))
				$classname = $row2['classname'].' ['.$row['classid'].']';
			else
				$classname = '<span class="red">分类已删除 ['.$row['classid'].']</span>';
			
			switch($row['checkinfo'])
			{
				case 'true':
					$checkinfo = '已审';
					break;  
				case 'false':
					$checkinfo = '未审';
					break;
				default:
					$checkinfo = '没有获取到参数';
			}
		?>
		<tr align="center" class="dataTr">
			<td class="firstCol"><input type="checkbox" name="checkid[]" id="checkid[]" value="<?php echo $row['id']; ?>" /></td>
			<td><?php echo $row['id']; ?></td>
			<td><span class="thumbs"><?php echo GetMgrThumbs($row['picurl']); ?></span></td>
			<td><?php echo $row['webname']; ?></td>
			<td><a href="<?php echo $row['linkurl']; ?>" target="_blank" title="点击访问"><?php echo $row['linkurl']; ?></a></td>
			<td><?php echo $classname; ?></td>
			<td class="action endCol"><span><a href="weblink_save.php?id=<?php echo $row['id']; ?>&action=check&checkinfo=<?php echo $row['checkinfo']; ?>" title="点击进行审核与未审操作"><?php echo $checkinfo; ?></a></span> | <span><a href="weblink_update.php?id=<?php echo $row['id']; ?>">修改</a></span> | <span class="nb"><a href="weblink_save.php?action=del2&id=<?php echo $row['id'] ?>" onclick="return ConfDel(2);">删除</a></span></td>
		</tr>
		<?php
		}	
		?>
				<?php

//判断无记录样式
if($dosql->GetTotalRow() == 0)
{
		echo '<tr><td align="center" colspan="7">暂无记录</td></tr>';
}
?>
	</table>
	</div>
</form>
<!--内容底部-->
<div class="line20"></div>
<div class="pagelist">
  <div class="l-btns">
    <span>显示</span><input name="txtPageNum" type="text" value="<?php echo $checkPagenum;?>"  onblur="checkPagenum(this.id)"  onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;" id="txtPageNum" class="pagenum" onkeydown="return checkNumber(event);" /><span>条/页</span>
  </div>
   <?php echo $dopage->GetList($sql,$checkPagenum); ?>
  <div class="l-btns"><span>
<?php 
$stoptimer = microtime(true);
$timer = $stoptimer-$starttimer;
echo " $timer s";?></span>
</div>
</div>
<!--/内容底部-->

</body>
</html>